//获取数据的api接口

//获取全部文章
import { userTokenStore } from '@/store/token';
import request from '@/util/request';
export function getAll(){
    return request.get('/article/getAll')
}

//有条件搜索文章
export function search(conditions){
    // console.log(conditions)
    return request.get('/article/search',{params: conditions})
}

//这里不用再定义async和await异步和同步等待了，只要在那边加一个等待script加载的同步就可以了，
//获取文章分类
export const articleCategoryListService = ()=>{
    return request.get('/category')
}
//添加文章分类
export const articleCategoryAddService = (categoryData)=>{
    return request.post('/addCategory',categoryData)
}
//编辑文章分类
export const articleCategoryEditService = (categoryData)=>{
    return request.put('/category',categoryData)
}
//删除文章分类
export const articleCategoryDeleteService = (id)=>{
    return request.delete('/category?id='+id)
}

//获取文章详情
export const articleListWithConditionService=(params)=>{
    return request.get('/article',{params: params});
}
//添加文章
export const articleAddService =(articleData)=>{
    return request.post('/article',articleData)
}
//修改文章
export const articleEditService =(articleData)=>{
    return request.put('/article',articleData)
}
//删除文章
export const articleDeleteService =(id)=>{
    return request.delete('/article?id='+id)
}